/*
 * @Author: funlee
 * @Email: i@funlee.cn
 * @Date: 2019-06-21 11:28:36
 * @Description: 首页-应用工具-企业信息检索-搜索主页
 */
import React from "react";
import "@/assets/style/search.scss";
import { message } from "antd";
import { observer, inject } from "mobx-react";

@inject("EnterpriseInformationRetrievalStore")
@observer
class EIRSearch extends React.Component {
    state = {
        keyWords: ""
    };
    handleChange = e => {
        this.setState({
            keyWords: e.target.value.trim()
        });
    };
    handleSearch = () => {
        const { keyWords } = this.state;
        if (keyWords === "") {
            message.error("请输入关键词");
            return;
        }
        this.props.EnterpriseInformationRetrievalStore.changeKeyWords(keyWords);
        this.props.history.push("/main/home/enterpriseInformationRetrieval/result");
    };
    render() {
        return (
            <div className="common-search">
                <div className="inner">
                    <h1 className="title">企业画像全息检索</h1>
                    <div className="search-wrap">
                        <input type="text" onChange={this.handleChange} placeholder="请输入任意APP或关键字" />
                        <button className="btn" onClick={this.handleSearch}>
                            搜索
                        </button>
                    </div>
                </div>
            </div>
        );
    }
}

export default EIRSearch;
